let input = `4
320124198808240056
12010X198901011234
110108196711301866
37070419881216001X`
let input_arr = input.split('\n')


let count = parseInt(input_arr[0])
let weight_arr = [7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2]
let is_all_passed = true;
for(let i = 0; i < count; i++){
    let id_no = input_arr[i+1]
    let result = 0;
    for(let j = 0; j < 17; j++){
        result+=id_no[j] * weight_arr[j]
    }
   
    result = result % 11

    let check_arr = ['1','0','x','9','8','7','6','5','4','3','2']

    if(id_no[17] !== check_arr[result]){
        is_all_passed = false
        console.log(id_no);
    }
}
if(is_all_passed === true){
    console.log('All passed');
}